package cn.tedu.charging.user.controller;

import cn.tedu.charging.common.protocol.JsonResult;
import cn.tedu.charging.user.service.WxLoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class UserController {
    @Autowired
    private WxLoginService wxLoginService;
    @GetMapping("/user/info/{userId}")
    public JsonResult<Integer> getUserCarInfo(@PathVariable("userId") Integer userId){
        log.info("查询用户车辆,入参:{}",userId);
        JsonResult result = JsonResult.ok(1);
        log.info("查询用户车辆,入参:{},结果:{}",userId,result);
        return result;
    }
    //微信登录接口
    @GetMapping("/wx/login")
    public JsonResult<Integer> wxLogin(String code,String nickname){
        log.info("微信登录,入参:{},{}",code,nickname);
        //调用业务方法
        Integer userId=wxLoginService.doLogin(code,nickname);
        return JsonResult.ok(userId);
    }
}
